home *** CD-ROM | disk | FTP | other *** search
/ Symantec Visual Cafe for Java 2.5 / symantec-visual-cafe-2.5-database-dev-edition.iso / Visual Cafe Pro v1.0 / SOURCE.BIN / TableCell.java < prev    next >
Encoding:
Java Source  |  1997-06-19  |  5.0 KB  |  177 lines

  1. /*
  2.  * TableCell.java   1.0   12 Jan 1997
  3.  *
  4.  * Copyright (c) 1996 Krumel & Associates, Inc.  All Rights Reserved.
  5.  *
  6.  * This software is provided as is.  Krumel & Associates shall not be liable
  7.  * for any damages suffered by licensee as a result of using, modifying or
  8.  * distributing this software or its derivatives.
  9.  */
  10.  
  11. package symantec.itools.db.awt;
  12.  
  13. import java.awt.*;
  14.  
  15. /**
  16.  * The TableCell interface serves as the basis for writing cells for the Grid.
  17.  */
  18. public interface TableCell {
  19.  
  20.     /**
  21.      * Style that indicates that a cell is part of the Grid proper.
  22.      */
  23.     public final static int CELL = 0;
  24.     /**
  25.      * Style value indicates the cell is part of the column headings
  26.      */
  27.     public final static int COL_HEADING = 1;
  28.     /**
  29.      * Style value indicates the cell is part of the row headings
  30.      */
  31.     public final static int ROW_HEADING = 2;
  32.     /**
  33.      * Style value indicates the cell is the corner cell
  34.      */
  35.     public final static int CORNER_CELL = 3;
  36.  
  37.     /**
  38.      * Called when a cell is added to the table through an API call after it
  39.      * has already been created.
  40.      * @param v The grid that contains the cell
  41.      * @param ds The grid's datasource that contains the cells data
  42.      */
  43.     public void setGrid(Grid v, DataSource ds);
  44.  
  45.     /**
  46.      * Sets the coordinates of the cell.
  47.      */
  48.     public void setCoordinates(Coordinate c);
  49.  
  50.     /**
  51.      * Gets the coordinate instance of the cell.
  52.      */
  53.     public Coordinate getCoordinates();
  54.  
  55.     /**
  56.      * Gets the row number of the cell
  57.      */
  58.     public int row();
  59.  
  60.     /**
  61.      * Sets the row number of the cell
  62.      */
  63.     public void setRow(int r);
  64.  
  65.     /**
  66.      * Gets the column number of the cell
  67.      */
  68.     public int col();
  69.  
  70.     /**
  71.      * Sets the column number of the cell
  72.      */
  73.     public void setCol(int c);
  74.  
  75.     /**
  76.      * Called by the grid when the cell needs to be painted
  77.      * @param g The graphics context to draw the cell
  78.      * @param hints The information required by the cell to render its image
  79.      */
  80.     public void drawCell(Graphics g, CellHints hints);
  81.  
  82.     /**
  83.      * Called by the grid when the user triggers a set events to indicate an
  84.      * action event on a cell
  85.      */
  86.     public boolean actionEvent(Event e);
  87.  
  88.     /**
  89.      * Called by the grid when the user triggers a set events to indicate
  90.      * mouse event on a cell (MOUSE_DOWN, MOUSE_UP, MOUSE_MOVE, ...)
  91.      */
  92.     public boolean mouseEvent(Event e);
  93.  
  94.     /**
  95.      * Called by the grid when the user triggers a set events to indicate
  96.      * key event on a cell (KEY_DOWN, KEY_UP, ...)
  97.      */
  98.     public boolean keyEvent(Event e);
  99.  
  100.     /**
  101.      * Called by the grid when the user triggers a set events to indicate
  102.      * focus change event for a cell (GOT_FOCUS, LOST_FOCUS)
  103.      */
  104.     public boolean focusEvent(Event e);
  105.  
  106.     /**
  107.      * When a cell has the keyboard focus, this method is called by the grid to
  108.      * determine if focus can be changed to another cell.
  109.      * @return true if current value is acceptable, false otherwise
  110.      */
  111.     public boolean canLoseFocus();
  112.  
  113.     /**
  114.      * When a cell has the keyboard focus, this method is called by the grid to
  115.      * determine if focus can be changed to another cell due to an arrow press
  116.      * @return true if current value is acceptable, false otherwise
  117.      */
  118.     public boolean loseFocusOnArrow();
  119.  
  120.     /**
  121.      * When a cell has the keyboard focus, this method is called by the grid to
  122.      * determine if the cell type supports user edits.
  123.      * @return true if can change values, false otherwise
  124.      */
  125.     public boolean isCellTypeEditable();
  126.  
  127.     /**
  128.      * Called by the grid to inform the cell the cursor should be shown if
  129.      * appropriate for the cell type
  130.      */
  131.     public void activateCursor();
  132.  
  133.     /**
  134.      * Called by the grid to inform the cell the cursor should not be drawn
  135.      * if appropriate for the cell type
  136.      */
  137.     public void deactivateCursor();
  138.  
  139.     /**
  140.      * Gets the applicable statistics for a cell, such as type, state, value, ...
  141.      */
  142.     public String stats();
  143.  
  144.     /**
  145.      * Gets the data stored by the DataSource for the cell
  146.      */
  147.     public Data getData() throws DataNotAvailable;
  148.  
  149.     /**
  150.      * Gets a duplicate of the cell
  151.      */
  152.     public TableCell cloneCell();
  153.  
  154.     /**
  155.      * Request the cell be put in a neutral state, ie not selected, no data, ...
  156.      */
  157.     public void reset();
  158.  
  159.     /**
  160.      * Sets the cell as a default cell.  Default cells are used by the grid
  161.      * when a cell has be explicitly created and stored in the grid.  The allows
  162.      * the grid to run without creating a large number of objects for large data sets.
  163.      */
  164.     public void setDefaultFlag();
  165.  
  166.     /**
  167.      * Sets the cell type, such as CELL and COL_HEADING
  168.      */
  169.     public int type(int t);
  170.  
  171.     /**
  172.      * Gets the cell type, such as CELL and COL_HEADING
  173.      */
  174.     public int type();
  175. }
  176.  
  177.